<?php

include "config.php";

if ($_COOKIE['ck'] != COOKIEKEY) { header("location: login.php"); }

require_once "zipfile.php";

$zipfile = new zipfile();

$myzips = array();
$myzips = unserialize(base64_decode($_REQUEST['kzip']));

if (is_array($myzips)) {
	 foreach ($myzips as $key=>$val) {
		$zipfile -> add_file(base64_decode($key),base64_decode($val));
	 }
	header("Content-type: application/octet-stream");
	header("Content-disposition: attachment; filename=ftpdownload.zip");
	echo $zipfile -> file();
}

?>